package com.xydtech.ecard.merchant.controller;

import com.xydtech.common.annotation.Log;
import com.xydtech.common.core.controller.BaseController;
import com.xydtech.common.core.domain.AjaxResult;
import com.xydtech.common.core.page.TableDataInfo;
import com.xydtech.common.enums.BusinessType;
import com.xydtech.common.utils.poi.ExcelUtil;
import com.xydtech.ecard.merchant.domain.EcardCustManagerMerchant;
import com.xydtech.ecard.merchant.service.IEcardCustManagerMerchantService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 营销人员建档个人信息查询
 *
 * @author yuzhiguo
 * @date 2024-09-12 下午5:26
 */
@Controller
@RequestMapping("/merchant/custManagerPerson")
public class EcardCustManagerPersonController extends BaseController {
    @Autowired
    private IEcardCustManagerMerchantService ecardCustManagerMerchantService;

    private String prefix = "merchant";

    @RequiresPermissions("merchant:custManagerPerson:view")
    @GetMapping()
    public String merchant()
    {
        return prefix + "/custManagerPerson";
    }

    @RequiresPermissions("merchant:custManagerPerson:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(EcardCustManagerMerchant ecardCustManagerMerchant) {
        startPage();
        List<EcardCustManagerMerchant> list = ecardCustManagerMerchantService.selectCustManagerPersonInfo(ecardCustManagerMerchant);
        return getDataTable(list);
    }

    @RequiresPermissions("merchant:custManagerPerson:export")
    @Log(title = "导出营销人员建档个人信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(EcardCustManagerMerchant ecardCustManagerMerchant)
    {
        List<EcardCustManagerMerchant> list = ecardCustManagerMerchantService.selectCustManagerPersonInfo(ecardCustManagerMerchant);
        ExcelUtil<EcardCustManagerMerchant> util = new ExcelUtil<EcardCustManagerMerchant>(EcardCustManagerMerchant.class);
        return util.exportExcel(list, "营销人员建档个人信息");
    }
}
